package com.huluobo.a2112mvvmdouyindemo.demoMVVM;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.huluobo.a2112mvvmdouyindemo.demoMVP.UserDemoBean;

/**
 * Created by LC on 2024/3/21.
 */
public class LoginDemoViewModel extends ViewModel {
    //成功的实际LiveData
    MutableLiveData<UserDemoBean> success = new MutableLiveData<>();

    //失败的实际的LiveData
    MutableLiveData<String> failed = new MutableLiveData<>();

    //数据仓库,相当于在P层中new出的Model
    LoginDemoRepo loginDemoRepo = new LoginDemoRepo();

    public void login(String username, String password) {
        loginDemoRepo.login(username, password, success, failed);
    }
}
